package workflow.step;

import java.util.Random;

import model.Software;

/**
 * Creates a new {@link Software} with a desired or default name.
 * 
 * @author Mark Czotter
 * @author Miklos Szennai
 * 
 */
public class SpecificationStep {

	private static int softwareCounter = 0;
	private static final String DEFAULT_PRODUCT_NAME = "AwesomeSoftware";
	
	public Software doStep(String softwareName) {
		String desiredName = DEFAULT_PRODUCT_NAME;
		if (softwareName != null && softwareName.length() > 0) {
			desiredName = softwareName;
		}
		int randNum = new Random().nextInt(10);
		Software s = new Software(softwareCounter++, desiredName + randNum);
		
		/*Instrumentation*/
		s.setStartTime(System.currentTimeMillis());
		/**/
		return s;
	}

}
